<template>
  <div class="app-container">
    <div class="app-container">
    <el-button size="small" type="primary" class="sx" @click.native="getList()" icon="el-icon-refresh">刷新</el-button>
    </div>
    <el-table :data="list" border style="width: 100%" v-loading="listLoading">
      <el-table-column prop="createTime" align="center" label="导出时间">
        <template slot-scope="scope">
          <span>{{scope.row.createTime}}</span>
        </template>
      </el-table-column>

      <el-table-column prop="progress" align="center" label="导出进度">
        <template slot-scope="scope">
          <span>{{scope.row.progress}}</span>
        </template>
      </el-table-column>

      <el-table-column prop="stat" align="center" label="导出状态">
        <template slot-scope="scope">
          <span v-html="scope.row.stat"></span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="下载">
        <template slot-scope="scope">
       <el-button type="primary" v-if="scope.row.show"  @click.native="download(scope.row)">下载</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="data.pageNo"
      :limit.sync="data.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import apiexportLogs from "@/api/export/exportLogs";
import Pagination from "@/components/Pagination";
export default {
  name: "index",
  components: { Pagination },
  data() {
    return {
      list: [],
      total:0,
      data: {
        pageNo: 1,
        pageSize: 10,
        listLoading:true
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    //列表查询
    getList() {
      this.listLoading=true
    apiexportLogs.getListquery(this.data.pageNo,this.data.pageSize).then(res => {
        this.list = res.list;
        this.total = res.total;
        this.listLoading=false;
      });
    },
    //下载
    download(row){
      apiexportLogs.download(row.filePath)
    },
  }
};
</script>

<style scoped>


</style>